const app = getApp();
var util = require('../../utils/util.js'); Page({
  data: {
    //用户个人信息  
    userInfo: {
      avatarUrl: "",//用户头像  
      nickName: "",//用户昵称  
    },
    firstContent: "U钱包",
    istrue: true,
    crusrTotalIncome: "",//累计佣金总额
    crusrFrozenIncome: "",//冻结佣金总额
    commission: "¥10",
    coupon: "¥16",
    nav: [
      { url: "../rechargeRecord/rechargeRecord", content: "充值记录" },
      { url: "../myCoupon/myCoupon", content: "优惠券" },
      { url: "../getCash/getCash", content: "申请提现" },
      { url: "../uFriends/uFriends", content: "我的U友" },
      { url: "../fillinfo/fillinfo", content: "完善信息" },
      { url: "../inviteFriends/inviteFriends", content: "邀请好友" }
    ]
  },
  onHide: function () {

  },
  onReady: function () {

  },
  onShow: function () {

  },
  onLoad: function (options) {
    var that = this;
    /* 获取用户信息*/
    wx.getUserInfo({
      success: function (res) {
        let avatarUrl = 'userInfo.avatarUrl';
        let nickName = 'userInfo.nickName';
        that.setData({
          'userInfo.avatarUrl': res.userInfo.avatarUrl,
          'userInfo.nickName': res.userInfo.nickName,
        });
      }
    });

    let data1 = {
      crusrUuid: app.globalData.userUuid
    }
    util.requestGet("coreUser/views", data1, function (res) {
      if (res.success) {
        console.log(res)
        that.setData({ "crusrTotalIncome": res.data.crusrTotalIncome });
        that.setData({ "crusrFrozenIncome": res.data.crusrFrozenIncome });
      } 
    }, function (errData) {
      util.tipModal(that, "获取失败！");
    });
  },
  // 点击U钱包
  changeState() {
    this.setData({ istrue: (!this.data.istrue) });
  }
})
